package com.huawei.esdk.tp.domain.util;

import com.huawei.esdk.platform.common.config.ConfigManager;
import com.huawei.esdk.platform.common.exception.SDKException;
import com.huawei.esdk.platform.common.utils.ApplicationContextUtil;
import com.huawei.esdk.platform.nemgr.itf.IDeviceManager;

/**
 * 南向设备连接管理类
 * <p>
 * @author  cWX191990
 * @see  [相关类/方法]
 * @since  [eSDK TP V100R003C20]
 */
public final class DeviceServiceProxy
{
    /**
     * 设备管理接口
     */
    public static final IDeviceManager DEVICE_MANAGER = (IDeviceManager)ApplicationContextUtil.getBean("deviceManager");
    
    /**
     * 单例
     */
    public static final DeviceServiceProxy DEVICE_SERVICE_PROXY = new DeviceServiceProxy();
    
    public static final String DEV_ID_SMC = ConfigManager.getInstance().getValue("esdk.smc_device_1");
    
    private DeviceServiceProxy()
    {
        
    }
    
    public static DeviceServiceProxy getInstance()
    {
        return DEVICE_SERVICE_PROXY;
    }
    
    public <T> T getDeviceServiceProxy(Class<T> clazz)
        throws SDKException
    {
        return DEVICE_MANAGER.getDeviceServiceProxy(DEV_ID_SMC, clazz);
    }
}
